<template>
  <div class="code-box flex-col-start">

      <div class="code-body">
        <p>前端</p>
        <div v-for="(item,index) in beforeUrlList" :key="index" class="code-item">
          <img :src="item.icon"/>
          {{item.name}} <a :href="item.url">
          {{item.url}}
          </a>
        </div>
      </div>

    <div class="code-body">
      <p>后端</p>
      <div v-for="(item,index) in afterUrlList" :key="index" class="code-item">
        <img :src="item.icon"/>
        {{item.name}} <a :href="item.url">
        {{item.url}}
      </a>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "Code",
  data(){
    return{
      beforeUrlList:[
        {
          name:"Gitee",
          url:"https://gitee.com/youlibinlovecode/mimiwang-vue2",
          icon:require("@/assets/img/about/gitee.png")
        },
        {
          name:"GitHub",
          url:"暂无",
          icon:require("@/assets/img/about/github.png")
        }
      ],
      afterUrlList:[
        {
          name:"Gitee",
          url:"https://gitee.com/youlibinlovecode/mi-mi-wang",
          icon:require("@/assets/img/about/gitee.png")
        },
        {
          name:"GitHub",
          url:"暂无",
          icon:require("@/assets/img/about/github.png")
        }
      ]
    }
  }
}
</script>

<style scoped lang="less">
  .code-box{
    width: 100%;
    height: 100%;
    border-radius: 2px;
    background-color: #F4F7F8;
    scroll-behavior: smooth;

    .code-body {
      display: flex;
      width: 70%;

      flex-direction: column;
      justify-content: flex-start;
      align-items: flex-start;
      margin-top: 40px;

      p {
        width: 20%;
        height: 40px;
        background-color: tomato;
        line-height: 40px;
        font-weight: 700;

      }
      .code-item{
        padding-left: 50px;
        margin: 10px 0;
        display: flex;

        img{
          width: 20px;
          height: 20px;
          margin-right: 10px;
        }
        a{
          position: relative;
          margin-left: 40px;
          text-decoration: none;
          color: teal;
          transition: all 0.3s;

          &:after{
            content: " ";
            width: 0;
            height: 100%;
            background-color: transparent;
            border-bottom: 2px solid tomato;
            position: absolute;
            left: 0;
            bottom: -5px;
            transition: all 0.5s;
          }
          &:hover{
            &:after{
              width: 100%;
            }
          }
        }
      }
    }
  }
</style>